<template>
	<van-swipe-cell @click="handleSwipeClick">
		<slot v-if="hasSlot('default')" name="default"></slot>
		<van-cell @click="handleClick" :title="item.srfmajortext"> </van-cell>
	</van-swipe-cell>
</template>
<script setup lang="ts">
import { MDCtrlItemProps } from '../md-ctrl';

const emit = defineEmits<{
	(name: 'item-action-click', logic: any, $event: any): void;
	(name: 'item-click', $event: any): void;
}>();
const props = defineProps(MDCtrlItemProps);

const handleClick = ($event: any) => {
	emit('item-click', $event);
};
const hasSlot = (name: string): boolean => {
	return !!useSlots()[name];
};
const handleSwipeClick = (tag: string) => {
	if ('outside' == tag) {
		return;
	}
	emit('item-click', null);
};
</script>
